<template>
  <ul class="list">
    <li class="item" v-for="(item,key) of cities" :key="key" :ref="key" @click="handleClickLetter">{{key}}</li>
  </ul>
</template>

<script>
export default {
  name: 'CityAlphabet',
  props: ['cities'],
  methods: {
    // 将点击的字母传给父组件
    handleClickLetter (e) {
      this.$emit('change',e.target.innerText)
    }
  }
}
</script>

<style lang="stylus" scoped>
  @import "~styles/variable.styl"
  .list
    display: flex
    flex-direction: column
    justify-content: center
    position: absolute
    right: 0
    top: 1.58rem
    bottom: 0
    width: .4rem
    .item
      line-height: .4rem
      text-align: center
      color: $bgColor
</style>
